<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p>fhjasl
        <span>djodsajoid</span>
        pfjs</p> <span>e701ejhenaln</span>
    <div style="padding-left: 10px;">31700000</div>
    <script>
        setInterval(() => {
            const sel = getSelection()
            const range = sel.getRangeAt(0)
            console.log(range.cloneContents().childNodes);
            console.log(range.commonAncestorContainer);
        }, 3000)
    </script>
</body>

</html>